﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;

namespace Luka.Log;

public static class LogSetup
{
    /// <summary>
    /// 配置日志服务
    /// </summary>
    public static IServiceCollection AddLog(this IServiceCollection services)
    {
        //数据服务
        services.AddTransient<IMongoService, MongoService>();
        // 插入到最后一个位置,确保 StartupFilter 总是最后一个注册的服务。
        services.Insert(services.Count - 1, ServiceDescriptor.Transient<IStartupFilter, StartupFilter>());
        // 返回服务
        return services;
    }
}